<template>
  <div class="avatar" :class="{ avatar__selected: !!selected }" >
    <div class="avatar_face">
      <img src="../assets/logo.png" alt />
    </div>
    <h2 class="avatar_name">Hello,chungchao</h2>
    <p class="avatar_tips">
      一举惊涛快哉风,世浪翻袖中
      <br />
      未完成任务: {{ todayTask.length }}
    </p>
    <p class="avatar_date">Today: {{ today  }}</p>
  </div>
</template>

<script>
import { mapState, mapGetters } from "vuex";
export default {
  data() {
    return {
      today: new Date().toLocaleString()  
    };
  },
  computed: {
    ...mapState(["selected"]),
    ...mapGetters(["todayTask"])
  },
  mounted(){
    console.table(this.todayTask)
  }
};
</script>

<style lang="scss" scoped>
.avatar {
  display: flex;
  padding: 10px 40px 0 40px;  
  justify-content: flex-end;
  flex-direction: column;
  transition: all 0.5s ease;
}
.avatar__selected {
  transform: translate3d(0, 20px, 0);
  opacity: 0;
}
.avatar_face {
  width: 44px;
  height: 44px;
  border-radius: 100%;
  overflow: hidden;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  img {
    display: block;
    width: 100%;
    height: 100%;
  }
}
.avatar_name {
  margin-top: 24px;
  padding: 0 6px;
  font-size: 32px;
  font-weight: 300;  
  letter-spacing: 1px;
  
}
.avatar_tips {
  margin-top: 12px;
  padding: 0 6px;
  font-size: 13px;
  opacity: 0.8;  
  font-weight: 100;
  line-height: 1.6em;
}
.avatar_date {
  margin-top: 12px;  
  font-size: 14px;
}
</style>
